<!--  -->
<template>
  <div class="model" v-show="isshowview" ref="wrap">
    <div id="preview" class="layui-layer layui-layer-page content">
      <div class="layui-layer-title">
        预览
        <i class="layui-icon layui-icon-close" @click="close">X</i>
      </div>
      <div class="layui-layer-content">
        <div class="detail-body" v-html="replaceConte"></div>
        <div class="detail-body"></div>
        <div class="layui-text"></div>
      </div>
    </div>
  </div>
</template>

<script>
import { escapeHtml } from "@/utils/escapeHtml";
export default {
  name: "preview",
  props: ["isshowview", "content"],
  components: {},
  data() {
    return {};
  },

  computed: {
    replaceConte() {
      //根据content的内容专一成为html代码
      if (typeof this.content === "undefined" || this.content.trim() === "") {
        // if(typeof this.content === 'undefined'){
        return;
      }
      return escapeHtml(this.content);
    },
  },

  mounted() {},

  methods: {
    close() {
      this.$emit("closeview");
    },
  },
};
</script>
<style scoped lang="scss">
#preview {
  position: fixed;
  width: 100%;
  height: 100%;
  background: #fff;
  top: 0;
  left: 0;
  z-index: 20004;
}
</style>
